<script setup lang="ts">
    import {useRouter} from 'vue-router'
    const cityMap = {
      "1": "北京",
      "2": "上海",
      "3": "天津",
      "4": "重庆",
      "5": "广州",
      "6": "深圳",
      "7": "成都",
      "8": "武汉",
      "9": "南京",
      "10": "西安",
      "11": "杭州",
      "12": "青岛",
      "13": "大连",
      "14": "宁波",
      "15": "厦门",
      "16": "苏州",
      "17": "佛山",
      "18": "长沙",
      "19": "郑州",
      "20": "济南",
      "21": "哈尔滨",
      "22": "长春",
      "23": "沈阳",
      "24": "昆明",
      "25": "南宁",
      "26": "海口",
      "27": "兰州",
      "28": "乌鲁木齐",
      "29": "呼和浩特",
      "30": "石家庄",
      "31": "太原",
      "32": "合肥",
      "33": "南昌",
      "34": "福州",
      "35": "贵阳",
      "36": "西宁",
      "37": "拉萨",
      "38": "银川",
      "39": "澳门",
      "40": "香港"
    };
    const props = defineProps({
        taskList: {
            type: Array<any>,
            default: () => []
        }
    })
    const router = useRouter()
    const gotoDetail = (id:any) =>{
        router.push('/task/details/'+id)
    }
</script>
<template>
    <div class="task-item" v-for="(item, index) in taskList" :key="index" @click="gotoDetail(item.jobId)">
        <div class="task-item-top">
            <h3>{{item.jobName}}</h3>
        </div>
        <dl>
            <dt>
                <h5>薪资</h5>
                <strong>￥{{item.jobBudget}}</strong>
            </dt>
        </dl>
        <p>工作描述：{{item.jobDescription}}</p>
        <div class="task-item-bottom">
            <label>{{item.companyName}}</label>
            <span><van-icon name="location-o" />{{cityMap[item.address] || "全国"}}</span>
        </div>
    </div>
</template>
<style scoped>
.task-item{
    background: #FFFFFF;
    border-radius: 0.53rem;
    margin:0 0 0.53rem;
    padding: 0.88rem 0.48rem 0.75rem;
    position: relative;
    font-size: 0.69rem;
    font-weight: 100;
    color: #666666;
}
.task-item-top{
    display: flex;
}
.task-item-top h3{
    font-size: 0.91rem;
    line-height: 0.91rem;
    font-weight: 400;
    color: #333333;
    margin-bottom: 1.01rem;
}
.task-item-top span{
    position: absolute;
    right: 0;
    width: 2.29rem;
    height: 1.08rem;
    line-height: 1.08rem;
    background: linear-gradient(90deg, #FEA829, #FE8F27);
    border-radius: 0.53rem 0 0 0.53rem;
    text-align: center;
    font-size: 0.59rem;
    color: #FFFFFF;
}
dl{
    display: flex;
    margin-bottom: 0.8rem;
}
dl dt{
    margin-right: 1.44rem;
}
dl dt h5{
    font-size: 0.69rem;
    line-height: 0.69rem;
    margin-bottom: 0.53rem;
    font-weight: 100;
    color: #999999;
}
dl dt strong{
    font-size: 0.64rem;
    line-height: 0.64rem;
    display: block;
    font-weight: 500;
    color: #333333;
}
.task-item p{
    color: #333333;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.task-item-bottom{
    display: flex;
    border-top: 1px solid #f5f5f5;
    margin-top: 0.72rem;
    padding-top: 0.72rem;
    line-height: 0.69rem;
}
.task-item-bottom label{
    flex: 1;
}
.task-item-bottom span{
    text-align: right;
}
.task-item-bottom i{
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: 0.1rem;
}
</style>